<template>
	<view class="content pc-tou-gao " >
		<view class="scroll-fix" >

		
			<view class="d-kuan-juzhong ">
				<!--头部-->
				<view class="d-kuan pc-dingbu " style="z-index: 100" >
					<DToubu 
					@login-success="handleLoginSuccess" 
					@logout-success="handleLogout"
					:dengluxianshi="denglu_xianshi"
					@update-dengluxianshi="handleUpdateDengluxianshi"
					@www-data="wwwdataget"
					></DToubu>
				</view>


				<!--头部-->
				<!--下面内容-->
				<view class="d-kuan d-xuanze-0">
					<!-- #ifdef H5 -->
					<link href="/static/css/wangeditor-style.css" rel="stylesheet" />
					<Toolbar
						style="z-index: 99999;"
						:editor="editorRef"
						:defaultConfig="toolbarConfig"
						:mode="mode"
					/>
					<Editor
						:style="{ height: leftNavHeight, paddingBottom: '120px' }"
						v-model="valueHtml"
						:defaultConfig="editorConfig"
						:mode="mode"
						@onCreated="handleCreated"
						@onChange="handleChange"
						@onFocus="handleFocus"

					/>
					<!-- #endif -->
					
					<!--选择圈子-->
					<view v-if="quanzizhi==1" class="d-kuan d-xuanze-1" :style="{height: xuanzequan_gao}">
						<view>
							<uv-tabs :list="quan_daohang_list" @click="yiji2" lineColor="#07bfa6" :activeStyle="{ color: '#0a9a87' }"></uv-tabs>
							<uv-tabs v-if="quan_daohang_list.length > 0 " :key="'erji-' + activeIndex.id"  :current="xuanzezhi" :list="erjidata" @click="erji2" lineColor="#07bfa6" :activeStyle="{ color: '#0a9a87' }"></uv-tabs>
                            <uv-row :customStyle="{ 'margin-top': '20px', 'flex-wrap': 'wrap','margin-left':'5px','margin-right':'5px','overflow-y':'auto', 'max-height': xuanzequan_list_gao }"  :gutter="20" wrap>




									<uv-col v-for="(list,index) in quan_list" span="12">
										<view class="beijing-140 d-kuan d-buhuanhang d-xia-20" @click="quan(list.id,list.title)">

											<!--图片-->
											<view class="d-zuo d-tu-kuan-140 d-piaofu-0">
												<!--view v-if="list.moshi==0" class="d-piaofu-1">免费</view>
												<view v-else class="d-piaofu-1">付费</view-->
												<uv-image :src="list.thumb" width="100rpx" height="100rpx" radius="50"></uv-image>
											</view>
											<view class="d-kuan d-neikuang-10">
												<view class="d-chaochu-1 d-jiacu">{{list.title}}</view>
												<view class="d-chaochu-1 d-ziti-12 d-wenzi-yanse-hui d-shangxia-5">
													{{list.description}}
												</view>
												<view class="d-chaochu-1 d-ziti-12 d-wenzi-yanse-hui d-shangxia-10">
													<uv-icon name="arrow-right" color="#a7a7a7" labelColor="#a7a7a7" size="10" :label="list.catname"></uv-icon>
												</view>

											</view>
											<view class="d-neikuang-10">
												<uv-button customStyle="margin-top: 20px;width: 80px" size="small" :plain="true" type="primary" shape="circle"  text="选择"></uv-button>
											</view>
										</view>


									</uv-col>
									<!-- 加载状态提示 -->
  									<view class="d-kuan d-juzhong d-shangxia-20" v-if="isLoading">
  									  <!--uv-loading></uv-loading-->
  									</view>
  									<view class="d-kuan d-juzhong d-shangxia-20 d-wenzi-hui" v-if="noMoreData">
  									  <uv-divider text="没有更多数据了"></uv-divider>
  									</view>

								</uv-row>
						</view>

					</view>

				</view>
				<!--下面内容-->


			</view>

			<view class="d-clear"></view>
		
		</view>
		<!--底部-->
	    <view class="d-kuan-juzhong">

			<view class="d-kuan d-dibu-50 d-shezhi-0">
				<view class="d-dibu-juzhong d-buhuanhang" style="position: relative;">
					<view class=" d-chaochu-1 d-ziti-12 d-wenzi-yanse-hui d-shangxia-5  d-shezhi-1" style="position:absolute; z-index:1000; top:-40px; left:20px;">
						<uv-tags icon="empty-address" @click="fujian_feiyong" text="设置费用" plain size="mini" shape="circle" type="error"></uv-tags>
					</view>	
					<!--上传图片-->
					<view class="example-body ">

						
						
						
						<uv-upload
							:fileList="fileList1"
							name="1"
							multiple
							leixing="1"
							:maxCount="1"
							@afterRead="afterRead"
							@delete="deletePic"
							@clickPreview="clickPreview"
							@insertImage="handleInsertImage"
							accept="image/*,video/*"
							:previewFullImage="true"
							width="50"
							height="50"

						></uv-upload>
						
					</view>
					<uv-upload
						:fileList="fileList_fujian1"
						name="1"
						multiple
						:maxCount="1"
						leixing="4"
						@afterRead="afterRead_fujian"
						@delete="delete_fujian"
						@insertVideo="handleInsertVideo_fujian"
						accept="all"
						fileType="all"
						:previewFullImage="true"
						width="50"
						height="50"
					></uv-upload>
					<view class="d-chaochu-1 d-ziti-12 d-wenzi-yanse-hui d-shangxia-5 d-zuo d-zuo-10">
						<uv-tags icon="empty-address" @click="xuanze_quan" :text="yixuan_title" plain size="mini" shape="circle" type="error"></uv-tags>
						
					</view>
				</view>
				
				<view class="d-dibu-juzhong ">
					<uv-row  gutter="15">
						<uv-col span="4">
							<view class="">
								<!--uv-button  @click="xuanze_quan" type="primary" :plain="true" :text="title"></uv-button-->
								<uv-icon name="arrow-left" color="#2979ff" size="28" @click="fanhui"></uv-icon>
							</view>
						</uv-col>
						<uv-col span="4">
							<view class="">
								<uv-button shape="circle" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" text="发布" @click="fabu_api"></uv-button>
							</view>
						</uv-col>
						<uv-col span="4">
							<view class="">
								<!--uv-button type="primary" :plain="true" text="选择圈子"></uv-button-->
							</view>
						</uv-col>
					</uv-row>

				</view>

			</view>

		</view>
		
		<!--view class="d-kuan d-waigao-20 d-bianhua-10 pc-yincang"></view-->

		<!--view class="d-clear pc-yincang"></view-->
		<!--view class="d-weibu pc-yincang">
			<Dweibu></Dweibu>
		</view-->
		<Dfujianfeiyong
			:fujian_feiyong_show="fujian_feiyong_show"
			:wwwData="wwwData"
			@close="fujian_feiyong_close"
			@fjfs-change="updateFujianFjfs"
			@jine-change="updateFujianJine"
			@jifen-change="updateFujianJifen"
		>

		</Dfujianfeiyong>

	</view>
</template>

<script>
    import Api from '@/utils/api.js';
	import Config from '@/utils/config.js';
	import QuanApi from '@/utils/quan_api.js';
	import { getRequest,postRequest } from '@/utils/wxRequest.js';
    //引入组件 d-toubu
    import DToubu from '@/components/d-toubu/d-toubu.vue'
	import Ddaohang from '@/components/d-daohang/d-daohang.vue'
	import Dweibu from '@/components/d-weibu/d-weibu.vue'

	import ccTwoCate from '@/uni_modules/cc-twoCate/components/cc-twoCate/cc-twoCate.vue'
    // #ifdef H5
    import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue';
	//import '@wangeditor/editor/dist/css/style.css' // 引入 css (移至最后提高优先级)
    import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
	// #endif
	import Dfujianfeiyong from '@/components/d-fujian_feiyong/d-fujian_feiyong.vue'
	
	
	
	export default {
		// #ifdef H5
			setup() {
				// 编辑器实例，必须用 shallowRef
				const editorRef = shallowRef(null)
				// 内容 HTML
				const valueHtml = ref('')
				// 编辑器配置
				
				// 编辑器模式，'default' 表示默认模式
				const mode = 'default'
				
				// 工具栏配置
				const toolbarConfig = {}
			// 排除不需要的菜单
			toolbarConfig.excludeKeys = [
				//'headerSelect',
				'headerSelect',
				'bold',//加粗
				'color',//颜色
				'bgColor',//文字背景颜色
				'lineHeight', //行高
				'todo', // 待办
				//'emotion', //表情
				'fontFamily',//字体
				'insertLink',//链接
                'bulletedList',//无序列
				'underline',
				'italic',
				'group-more-style', // 排除菜单组
				'group-image', // 排除图片上传
				'group-video',  // 排除视频上传
				'undo',
				'redo',
				'fullScreen',
				'divider',
				'group-indent',
				'numberedList', // 有序列表
			]
			const editorConfig = {
				placeholder: '第一行是标题，第二行起为内容。请输入内容...',
				// 配置hoverbarKeys，控制选中内容时出现的悬停工具栏
				hoverbarKeys: {
					// 文本选中时显示的按钮
					text: {
						menuKeys: [
							'headerSelect',
							'bold', // 加粗
							//'italic', // 斜体
							'underline', // 下划线
							'color', // 文字颜色
							'bgColor', // 背景颜色
							'bulletedList', // 无序列表
							'numberedList', // 有序列表
							'insertLink',//链接
							//'blockquote', // 引用
							//'code', // 行内代码
							//'clearStyle' // 清除格式
						]
					},
					// 图片选中时显示的按钮
					/*image: {
						menuKeys: [
							'deleteImage', // 删除图片
							'editImage', // 编辑图片
							'viewImageSource', // 查看图片源码
							// 可以根据需要添加其他图片相关操作
						]
					},*/
					// 链接选中时显示的按钮
					/*link: {
						menuKeys: [
							'editLink', // 编辑链接
							'unLink', // 取消链接
							'viewLinkSource' // 查看链接源码
						]
					}*/
					// 可以根据需要添加其他元素类型的配置，如video、header等
				},
				MENU_CONF: {
					// 配置上传图片
					image: {
						uploadType: 'custom',
						customUpload: () => {}, // 占位，实际不使用
					},
					// 配置上传视频
					video: {
						uploadType: 'custom',
						customUpload: () => {}, // 占位，实际不使用
					}
				}
			}
			// 模拟 ajax 异步获取内容
			/*onMounted(() => {
				setTimeout(() => {
				valueHtml.value = '<p>模拟 Ajax 异步设置内容</p>'
				}, 1500)
			})*/
			// 定义响应式变量 neirong
			const neirong = ref('')
			const title_20 = ref('')

			// 编辑器创建时的回调函数
				const handleCreated = (editor) => {
					console.log('handleCreated回调被调用！editor实例:', editor);
					editorRef.value = editor // 记录 editor 实例
					console.log('editor is created', editor);
					// 检查编辑器方法是否存在
					console.log('编辑器支持insertImage:', typeof editor.insertImage === 'function');
					console.log('编辑器支持cmd.do:', editor.cmd && typeof editor.cmd.do === 'function');

				// 添加粘贴事件监听器，支持粘贴图片到编辑器
				if (editor && editor.el) {
					const editorDom = editor.el;
					editorDom.addEventListener('paste', async (e) => {
						e.preventDefault(); // 阻止默认粘贴行为

						// 检查剪贴板中是否有图片
						const items = (e.clipboardData || e.originalEvent.clipboardData).items;
						for (let i = 0; i < items.length; i++) {
							const item = items[i];
							if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
								const file = item.getAsFile();
								if (file) {
									try {
										// 显示上传中提示
										uni.showLoading({ title: '图片上传中...' });

										// 调用上传函数，上传图片到服务器
										const uploadResult = await uploadFilePromise(file, 'image');
											
										if (uploadResult && uploadResult.url) {
											// 使用已有的handleInsertImage函数将图片插入到编辑器
											handleInsertImage({ url: uploadResult.url, thumb: uploadResult.url });
											uni.hideLoading();
										} else {
											throw new Error('图片上传失败');
										}
									} catch (error) {
										console.error('粘贴图片上传失败:', error);
										uni.hideLoading();
										uni.showToast({
											title: '图片上传失败，请重试',
											icon: 'none'
										});
									}
								}
								break;
							}
						}
					});

					// 添加拖拽事件监听器，支持拖拽图片到编辑器
					// 当拖拽元素经过编辑器时
					editorDom.addEventListener('dragover', (e) => {
						e.preventDefault();
						e.stopPropagation();
						editorDom.style.border = '2px dashed #07bfa6'; // 添加拖拽提示边框
					});

					// 当拖拽元素离开编辑器时
					editorDom.addEventListener('dragleave', () => {
						editorDom.style.border = 'none'; // 移除拖拽提示边框
					});

					// 当拖拽元素在编辑器上释放时
					editorDom.addEventListener('drop', async (e) => {
						e.preventDefault();
						e.stopPropagation();
						editorDom.style.border = 'none'; // 移除拖拽提示边框

						// 检查拖拽的文件中是否有图片
						const files = e.dataTransfer.files;
						for (let i = 0; i < files.length; i++) {
							const file = files[i];
							if (file.type.indexOf('image/') !== -1) {
								// 获取图片格式
								const fileExtension = file.name.split('.').pop().toLowerCase();
								const validFormats = ['jpg', 'jpeg', 'png', 'gif'];
								const displayFormat = validFormats.includes(fileExtension) ? fileExtension : '未知';
								
								// 显示确认对话框
								uni.showModal({
									title: '图片确认',
									content: `确定要上传这张${displayFormat}格式的图片吗？`,
									confirmText: '确定',
									cancelText: '取消',
									async success(res) {
										if (res.confirm) {
											try {
												// 保存当前this上下文
												const that = this;
													
												// 显示上传中提示
												uni.showLoading({ title: '图片上传中...' });

												// 创建临时URL作为文件路径
												const fileUrl = URL.createObjectURL(file);
												// 调用上传函数，上传图片到服务器
												const uploadResult = await that.uploadFilePromise(fileUrl, 1);

												if (uploadResult) {
													// 使用已有的handleInsertImage函数将图片插入到编辑器
													that.handleInsertImage({ url: uploadResult, thumb: uploadResult });
													uni.hideLoading();
												} else {
													throw new Error('图片上传失败');
												}
											} catch (error) {
													console.error('拖拽图片上传失败:', error);
													uni.hideLoading();
													uni.showToast({
														title: '图片上传失败，请重试',
														icon: 'none'
													});
												}
											}
										}
									});
									break;
								}
							}
						});
				}
			}
			const handleChange = (editor) => {
			    //console.log('change:', editor.getHtml())
				neirong.value = editor.getHtml();
				//title_20.value = editor.getText();
				title_20.value = editor.getHtml();
				
				//console.log('change:', editor.getAllMenuKeys())
			}
			const handleFocus = (editor) => {
			    //console.log('focus', editor)
			}

			
			// 处理插入图片到编辑器
			const handleInsertImage = (event) => {
				//console.log('handleInsertImage事件触发', event);
				// 获取图片URL
				const imageUrl = event.url || event.thumb;
				//console.log('图片URL:', imageUrl);
				if (imageUrl) {
					// 检查编辑器实例
					if (editorRef.value) {
						try {
							// 确保编辑器有焦点
							editorRef.value.focus();

							// 延迟执行插入，确保焦点已获取
							setTimeout(() => {
								// 使用insertImage方法（如果可用）
								if (typeof editorRef.value.insertImage === 'function') {
									editorRef.value.insertImage(imageUrl);
									//console.log('使用insertImage方法在光标位置插入图片成功');
								} else if (editorRef.value.cmd && typeof editorRef.value.cmd.do === 'function') {
									// 确保插入到正确的位置
									const imageHtml = `<img src="${imageUrl}" style="max-width:100%;height:auto;" />`;
									editorRef.value.cmd.do('insertHTML', imageHtml);
									//console.log('使用cmd.do在光标位置插入图片成功');
								} else {
									console.error('编辑器实例不支持在光标位置插入图片的方法');
									// 尝试其他可能的插入方法
									try {
										const imageHtml = `<img src="${imageUrl}" style="max-width:100%;height:auto;" />`;
										
										// 检查是否有pasteHTML方法
										if (typeof editorRef.value.pasteHTML === 'function') {
											editorRef.value.pasteHTML(imageHtml);
											//console.log('使用pasteHTML方法在光标位置插入图片成功');
										} 
										// 检查是否有insert方法
										else if (editorRef.value.insert) {
											editorRef.value.insert(imageHtml);
											//console.log('使用insert方法在光标位置插入图片成功');
										} 
										// 检查是否有document属性并尝试execCommand
										else if (editorRef.value.document && typeof editorRef.value.document.execCommand === 'function') {
											editorRef.value.document.execCommand('insertHTML', false, imageHtml);
											//console.log('使用document.execCommand在光标位置插入图片成功');
										} 
										// 检查是否有setContent方法
										else if (typeof editorRef.value.setContent === 'function') {
											const currentContent = editorRef.value.getContent() || '';
											editorRef.value.setContent(currentContent + imageHtml);
											//console.log('使用setContent方法在内容末尾插入图片成功');
										} 
										// 检查是否有append方法
										else if (typeof editorRef.value.append === 'function') {
											editorRef.value.append(imageHtml);
											//console.log('使用append方法在内容末尾插入图片成功');
										} 
										// 检查是否有addContent方法
										else if (typeof editorRef.value.addContent === 'function') {
											editorRef.value.addContent(imageHtml);
											//console.log('使用addContent方法在内容末尾插入图片成功');
										} 
										// 检查是否可以直接访问DOM
										else if (editorRef.value.el && editorRef.value.el.innerHTML) {
											editorRef.value.el.innerHTML += imageHtml;
											//console.log('直接操作DOM在内容末尾插入图片成功');
										} 
										// 所有方法都失败，直接在末尾插入
										else {
											//console.log('所有插入方法都不支持，直接在末尾插入');
											const imageHtml = `<p><img src="${imageUrl}" style="max-width:100%;height:auto;" /></p>`;
											editorRef.value.setHtml(editorRef.value.getHtml() + imageHtml);
											//console.log('在内容末尾插入图片成功');
											/*uni.showToast({
												title: '图片已插入到内容末尾',
												icon: 'none'
											});*/
										}
									} catch (e) {
										console.error('所有插入方法都失败:', e);
										// 备选方案：在内容末尾插入
										const imageHtml = `<p><img src="${imageUrl}" style="max-width:100%;height:auto;" /></p>`;
										editorRef.value.setHtml(editorRef.value.getHtml() + imageHtml);
										//console.log('在内容末尾插入图片成功');
										// 显示提示给用户
										uni.showToast({
											title: '无法在光标位置插入图片，已在内容末尾插入',
											icon: 'none'
										});
									}
									return;
									
								}
							}, 100);
						} catch (error) {
							console.error('插入图片时发生错误:', error);
							uni.showToast({
								title: '插入图片失败: ' + error.message,
								icon: 'none'
							});
						}
					} else {
						console.error('编辑器实例不存在');
						uni.showToast({
							title: '编辑器尚未准备好，请稍后再试',
							icon: 'none'
						});
					}
				} else {
					console.error('未找到图片URL');
					uni.showToast({
						title: '未找到图片URL',
						icon: 'none'
					});
				}
			}

			// 视频类型检测函数
			const getVideoType = (url) => {
				const ext = url.split('.').pop().toLowerCase();
				const videoTypes = {
					'mp4': 'video/mp4',
					'webm': 'video/webm',
					'ogg': 'video/ogg',
					'mov': 'video/quicktime',
					'avi': 'video/x-msvideo',
					'wmv': 'video/x-ms-wmv'
				};
				return videoTypes[ext] || null;
			};

			// 提取视频封面函数
			const extractVideoCover = (videoUrl) => {
				return new Promise((resolve) => {
					const video = document.createElement('video');
					video.src = videoUrl;
					video.crossOrigin = 'anonymous';
					video.addEventListener('loadedmetadata', () => {
						// 视频加载元数据后，跳转到第1秒处（避免黑屏）
						video.currentTime = 1;
						video.addEventListener('seeked', () => {
							const canvas = document.createElement('canvas');
							canvas.width = video.videoWidth;
							canvas.height = video.videoHeight;
							const ctx = canvas.getContext('2d');
							ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
							// 将canvas转换为图片URL
							const coverUrl = canvas.toDataURL('image/jpeg');
							resolve(coverUrl);
						}, { once: true });
					});
					// 错误处理
					video.addEventListener('error', () => {
						console.error('视频封面提取失败');
						resolve(null);
					}, { once: true });
				});
			};

			// 处理插入视频到编辑器
			const handleInsertVideo_shipin = async (event) => {

				//console.log('handleInsertVideo事件触发', event);
				// 获取视频URL
				const videoUrl = event.url || event.tempFilePath || '';
				//console.log('视频URL:', videoUrl);
				let coverUrl = null;
				if (videoUrl) {
					// 提取视频封面
					coverUrl = await extractVideoCover(videoUrl);
					//console.log('视频封面URL:', coverUrl);

					// 检查编辑器实例
					if (editorRef.value) {
						try {
							// 确保编辑器有焦点
							editorRef.value.focus();

							// 延迟执行插入，确保焦点已获取
							setTimeout(() => {
								// 使用insertVideo方法（如果可用）
								if (typeof editorRef.value.insertVideo === 'function') {
									// 如果支持封面参数，则传入封面URL
									if (coverUrl) {
										editorRef.value.insertVideo(videoUrl, { poster: coverUrl });
									} else {
										editorRef.value.insertVideo(videoUrl);
									}
									//console.log('使用insertVideo方法在光标位置插入视频成功');
								} else if (editorRef.value.cmd && typeof editorRef.value.cmd.do === 'function') {
									// 确保插入到正确的位置
									const videoHtml = coverUrl ? 
										`<video src="${videoUrl}" poster="${coverUrl}" controls style="max-width:100%;height:auto;"></video>` : 
										`<video src="${videoUrl}" controls style="max-width:100%;height:auto;"></video>`;
									editorRef.value.cmd.do('insertHTML', videoHtml);
									//console.log('使用cmd.do在光标位置插入视频成功');
								} else {
									console.error('编辑器实例不支持在光标位置插入视频的方法');
									// 尝试其他可能的插入方法
									try {
										// 构建带封面的视频HTML
										const videoType = getVideoType(videoUrl);
										let videoHtml = coverUrl ? 
											`<video src="${videoUrl}" poster="${coverUrl}" ${videoType ? `type="${videoType}"` : ''} controls style="max-width:100%;height:auto;"></video>` : 
											`<video src="${videoUrl}" ${videoType ? `type="${videoType}"` : ''} controls style="max-width:100%;height:auto;"></video>`;
										
										// 检查是否有pasteHTML方法
										if (typeof editorRef.value.pasteHTML === 'function') {
											editorRef.value.pasteHTML(videoHtml);
											//console.log('使用pasteHTML方法在光标位置插入视频成功');
										} 
										// 检查是否有insert方法
										else if (editorRef.value.insert) {
											editorRef.value.insert(videoHtml);
											//console.log('使用insert方法在光标位置插入视频成功');
										} 
										// 检查是否有document属性并尝试execCommand
										else if (editorRef.value.document && typeof editorRef.value.document.execCommand === 'function') {
											editorRef.value.document.execCommand('insertHTML', false, videoHtml);
											//console.log('使用document.execCommand在光标位置插入视频成功');
										} 
										// 检查是否有setContent方法
										else if (typeof editorRef.value.setContent === 'function') {
											const currentContent = editorRef.value.getContent() || '';
											editorRef.value.setContent(currentContent + videoHtml);
											//console.log('使用setContent方法在内容末尾插入视频成功');
											/*uni.showToast({
												title: '视频已插入到内容末尾',
												icon: 'none'
											});*/
										} 
										// 所有方法都失败，直接在末尾插入
										else {
											//console.log('所有插入方法都不支持，直接在末尾插入');
											// 添加视频格式检查和type属性
											const videoType = getVideoType(videoUrl);
											const videoHtmlWithType = videoType ? 
												`<p><video src="${videoUrl}" type="${videoType}" controls style="max-width:100%;height:auto;"></video></p>` : 
												`<p><video src="${videoUrl}" controls style="max-width:100%;height:auto;"></video></p>`;
											editorRef.value.setHtml(editorRef.value.getHtml() + videoHtmlWithType);
											//console.log('在内容末尾插入视频成功');
											/*uni.showToast({
												title: '视频已插入到内容末尾',
												icon: 'none'
											});*/
										}
									} catch (e) {
										console.error('所有插入方法都失败:', e);
										// 备选方案：在内容末尾插入
										const videoHtml = `<p><video src="${videoUrl}" controls style="max-width:100%;height:auto;"></video></p>`;
										editorRef.value.setHtml(editorRef.value.getHtml() + videoHtml);
										//console.log('在内容末尾插入视频成功');
										// 显示提示给用户
										uni.showToast({
											title: '无法在光标位置插入视频，已在内容末尾插入',
											icon: 'none'
										});
									}
									return;
								}
							}, 100);
						} catch (error) {
							console.error('插入视频时发生错误:', error);
							uni.showToast({
								title: '插入视频失败: ' + error.message,
								icon: 'none'
							});
						}
					} else {
						console.error('编辑器实例不存在');
						uni.showToast({
							title: '编辑器尚未准备好，请稍后再试',
							icon: 'none'
						});
					}
				} else {
					console.error('未找到视频URL');
					uni.showToast({
						title: '未找到视频URL',
						icon: 'none'
					});
				}
			}

			return {
				editorRef,
				valueHtml,
				neirong,
				title_20,
				mode: 'default', // 或 'simple'
				toolbarConfig,
				editorConfig,
				handleCreated,
				handleChange,
				handleFocus,
				handleInsertImage,
				handleInsertVideo_shipin

			}
			
		},
		// #endif
		data() {
			return {
				leftNavHeight: '', // 默认高度

				ftNavHeight: '500rpx', // 默认高度
				
                rightColWidth: '300px', // 默认宽度
				rightColLeft: '0px', // 添加这个属性
				imageSize:'',
			
     		    width: 0,
        		height: 0,
				denglu_xianshi:0, // 登录显示
				kuan_shu: 8, //格大小
				swiperHeight: '250',
				gao: '20', //图片高度
				id: '', // 存储从全局获取的id",
				tid:'', // 存储从全局获取的tid",
				title:'', // 存储从全局获取的title",
				quanzizhi:0, // 全选
				xuanzequan_gao:0,
				xuanzequan_list_gao:0,
				categoryList:[],
				dataList:[],
				currentTwo:0,
				quan_daohang_list:[], // 圈子导航列表
				quan_list:[], // 圈子列表
				erjiindex:'',//当前激活的二级菜单索引
				activeIndex: -1, // 当前激活的一级菜单索引
				xuanzezhi:0, // 列表
				currentPage: 1, //下拉加载
    			pageSize: 12, //下拉加载
    			isLoading: false, //下拉加载
    			noMoreData: false, //下拉加载
				// 点击“设置费用”弹窗显示标记
				fujian_feiyong_show: false,
				// 附件费用方式（子组件回传 fjfs 值）
				fujian_feiyong_fjfs: '0',
				// 附件费用金额与积分（子组件回传）
				fujian_feiyong_jine: 0,
				fujian_feiyong_jifen: 0,

				//上传图片
				fileList1: [],//图片存储
				fabuid:{},//发布id
				uptu:[],
				//上传视频
				fileList_shipin1: [],//视频存储
				fileList_fujian1: [],//附件存储
				fabuid_shipin:{},//发布id
				up_shipin:[],
				yixuan_title:'', // 已经选择的圈子名称
				leixing: 0 , //类型
				config: Config,
				wwwData:{},
				



			}
		},
		components: {
  		    DToubu,
			Ddaohang,
			Dweibu,
			// #ifdef H5
			Editor, 
			Toolbar,
			// #endif
			ccTwoCate,
			Dfujianfeiyong,
  		},
		// 组件销毁时，也及时销毁编辑器
      
		mounted() {
			//var m = this.$store.state;
			//console.log('mmmm',m);
			
    	    this.setLeftNavHeight();
			this.getRightColWidth(); // 添加这行
    	    // 添加窗口大小变化监听
    	    window.addEventListener('resize', this.setLeftNavHeight);
			window.addEventListener('resize', this.getRightColWidth); // 添加窗口大小变化监听
			var e = this;
			//this.onImageLoad(e);
    	},
    	beforeDestroy() {
    	    // 移除监听
    	    window.removeEventListener('resize', this.setLeftNavHeight);
			window.removeEventListener('resize', this.getRightColWidth); // 添加这行
    	},
		onShow() {
			const storeUid = this.$store.state.memberuid;
			this.uid = storeUid;
			if(!storeUid){
				//console.log('没有登录，跳转到登录页面');
				this.denglu_xianshi = 1;
				this.godenglu(); // 暂时注释掉自动跳转，便于调试
			}
			//var m = this.$store.state;
			//this.id = getApp().globalData.currentId || '';
			this.title = getApp().globalData.title || '';
			//console.log('获取到的id:', this.id);
			this.quan(this.id,this.title);
			this.getFabuid_api();
			
			// 可以在这里使用id进行其他操作
			// 使用后可以选择清除全局变量，避免下次进入时仍有值
			// getApp().globalData.currentId = null;
		},
		onLoad(e) {
			this.id = e.id;
			this.leixing = e.leixing;
			this.tid = e.tid;
		},
		computed: {
			yidenglu() {
				return (this.$store.state.memberuid && this.$store.state.keycode) ? 1 : 0;
			},
			touxiang() {
				return this.$store.state.member? this.$store.state.member.avatar : '';
			},
		    name1() {
				return this.$store.state.member ? this.$store.state.member.name : '';
			}
		},
		methods: {
			wwwdataget(e){
				this.wwwData = e;
			},
			//图片
			onImageLoad(e, index) {
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowWidth;
				if(windowHeight >=920){
					var gao = 30;
					
				} else {
					var gao = 0;

				}


				this.$nextTick(() => {
        		    const query = uni.createSelectorQuery().in(this);
        		    query.select('#tupian-'+index).boundingClientRect(data => {
        		        if (data && data.width > 0 && data.height > 0) {
        		            this.$set(this.haibao_data[index], 'imageSize', {
        		                width: data.width,
        		                height: data.height + gao
        		            });
							//console.log('图片尺寸:', this.haibao_data[index].imageSize);
        		        } else {
        		            console.warn(`图片${index}尺寸获取失败`);
        		            this.$set(this.haibao_data[index], 'imageSize', {
        		                width: 300,
        		                height: 200
        		            });
        		        }
        		    }).exec();
        		});

    		},
			getRightColWidth() {
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowWidth = systemInfo.windowWidth;
				var d = this;

                this.$nextTick(() => {
				if(windowWidth >=920){
					d.gao = 20;
					d.kuan_shu = 8;
					d.swiperHeight = '250';
				} else {
					d.gao = 10;
					d.kuan_shu = 12;
					d.swiperHeight = '120';

				}
				//console.log('窗口高度:', windowWidth);

                 const query = uni.createSelectorQuery().in(this);
                 query.select('#youbiankuan').boundingClientRect(rect => {
                   if (rect) {
                     /*this.rightColWidth = `${rect.width+20}px`;
                     console.log('右侧列宽度:', this.rightColWidth);*/
					 	this.rightColWidth = `${rect.width-80}px`;
                    	this.rightColLeft = `${rect.left}px`; // 计算左侧位置
                    	//console.log('右侧列位置:', this.rightColWidth);
                   }
                 }).exec();
               });
            },

			//首页
			shouye(){
				uni.navigateTo({
					url: '/pages/index/index',
					fail: (err) => {
						console.error('跳转失败:', err)
					}
				})
			},
			
			setLeftNavHeight() {
        	    // 获取系统信息
        	    const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowHeight;
        	    const headerHeight = 95; // 头部高度估计值
        	    const calculatedHeight = windowHeight - headerHeight;
				
        	    // 设置左边导航高度
        	    this.leftNavHeight = `${calculatedHeight}px`;

				const quan_gao = 60; // 头部高度估计值
        	    const quan_gao_1 = windowHeight - quan_gao;
				this.xuanzequan_gao = `${quan_gao_1}px`;

				const quan_list_gao = 200; // 头部高度估计值
				const quan_list_gao_1 = windowHeight - quan_list_gao;
				this.xuanzequan_list_gao = `${quan_list_gao_1}px`
        	},
			
			handleLoginSuccess() {
  			  this.$forceUpdate();
  			},
			
			
			
			denglu_fabu(){
				if(this.yidenglu == 0){
					this.denglu_xianshi = 1;
				} else {
					this.denglu_xianshi = 0;	
				}
				
				//console.log('发布登录',this.denglu_xianshi);
				
			},
			// 更新判断是否登录
			handleUpdateDengluxianshi(value) {
			  this.denglu_xianshi = value;
			  //console.log('关闭登录',this.denglu_xianshi);
			},
			// 点击“设置费用”按钮，打开附件费用弹窗
			fujian_feiyong() {
				this.fujian_feiyong_show = true;
			},
			// 子组件通知关闭时，重置显示标记
			fujian_feiyong_close() {
				this.fujian_feiyong_show = false;
			},
			// 子组件回传费用方式 fjfs 时，存入父组件状态
			updateFujianFjfs(val) {
				this.fujian_feiyong_fjfs = val;
				// 同步清理不相关的数值，避免遗留
				if (val === '0') {
					this.fujian_feiyong_jine = 0;
					this.fujian_feiyong_jifen = 0;
				} else if (val === '1') {
					this.fujian_feiyong_jifen = 0;
				} else if (val === '2') {
					this.fujian_feiyong_jine = 0;
				}
			},
			// 子组件回传金额时（>0）
			updateFujianJine(val) {
				this.fujian_feiyong_jine = Number(val) || 0;
			},
			// 子组件回传积分时（>0）
			updateFujianJifen(val) {
				this.fujian_feiyong_jifen = Number(val) || 0;
			},
			xuanze_quan(){
				// 点击切换状态：1->0, 0->1
				this.quanzizhi = this.quanzizhi === 1 ? 0 : 1;
				if(this.quanzizhi == 1){
					this.quan_daohang_api(); // 圈子导航
					var e = this;
			        this.quan_list_api(e,false);
				}

				
			},
			yiji2(index) {
				this.xuanzezhi = 0;
				
				console.log(this.xuanzezhi);
    		  // 切换激活的一级菜单
			  setTimeout(() => {

    			  	this.activeIndex = index;
    			  	// 根据激活的一级菜单显示对应的二级菜单
				  	if(index.id == 0){
						this.erjidata = [];
				  	}else{
						this.erjidata = this.quan_daohang_list[index.index].son;
				  	}
				  	const data = {
						  categories:index.id,
						  page: 1 // 重置页码
				  	}
					this.currentPage = 1; // 重置页码
					this.noMoreData = false; // 重置无更多数据标志
				  	this.quan_list_api(data,false);
					  
				}, 300);
    		  
			  
    		},
			erji2(index) {
				this.xuanzezhi = index.index;
    		  // 切换激活的二级菜单
    		  this.erjiindex = index.id;
			  this.activeIndex = index;

			  const data = {
				  categories:index.id,
				  page: 1 // 重置页码
			  }
			    this.currentPage = 1; // 重置页码
				this.noMoreData = false; // 重置无更多数据标志
				this.quan_list_api(data,false);
				//console.log('二级分类：',index);

    		},
			//获取圈子
			getQuan(){
				// 选择圈子数据
				
				var get_data = getRequest(QuanApi.getXuanze_quan());

				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						var daohang_list = res.data ? res.data.data[0].daohang_list : [];
						var quan_list = res.data ? res.data.data[0].quan_list : [];
						//console.log('选择圈子',quan_list);

						this.categoryList = daohang_list;
						this.dataList = quan_list;
						
					}
				})

			},
			// 圈子导航接口
			quan_daohang_api(){
				var get_data = getRequest(Api.getQuan_daohang());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						var list = res.data && res.data.data ? res.data.data.lisi2 : [];
						// 在 list 前面添加插入一个新的数据“首页”
						
        				this.quan_daohang_list = list;
						console.log(list);
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
			},
			//列表接口
			quan_list_api(data, isLoadMore = false){
				if (!data) data = {};
				if (!data) data = {};
		  		if (!data.page) data.page = 1;
		  		if (!data.categories) data.categories = 0;
		  		if (!data.search) data.search = '';
				const url = {
					'kaifangfabu':1,
				};
				var get_data = getRequest(Api.getQuan_list(data),url);
				var res;	
				get_data.then(duixin_data => {
					res = duixin_data;	
					if(res.data.code) {
						// 转换时间戳为日期格式
						var list = res.data? res.data.data : {};
						//this.zhishi_list = list;
						if (isLoadMore) {
							// 加载更多时追加数据
							this.quan_list = [...this.quan_list, ...list];
							//this.quan_list = list;
        				} else {
        				  // 非加载更多时替换数据
        				  this.quan_list = list;
        				}	
						// 判断是否还有更多数据
						this.noMoreData = list.length < this.pageSize;
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
					this.isLoading = false;
				}).catch(() => {
    			  this.isLoading = false;
    			  if (isLoadMore) {
    			    this.currentPage--; // 加载失败时回退页码
    			  }
    			});
			},
			// 下拉加载更多
  			onReachBottom() {
  			  if (this.isLoading || this.noMoreData) return;
  			  this.isLoading = true;
  			  this.currentPage++;
			  // 获取当前激活的分类ID
    			const currentCategoryId = this.activeIndex.id >= 0 ? this.activeIndex.id : 0;
    			

  			  const data = {
  			    page: this.currentPage,
  			    categories: currentCategoryId
  			  };
			 // console.log('分页',this.activeIndex.id);
  			  this.quan_list_api(data, true); // 添加第二个参数表示是加载更多
  			},
			quan(id,title){
				if(id){
					this.id = id;
					this.title = '已选'; //+title
					this.quanzizhi = 0;
					this.yixuan_title = title+'圈'; //已经选择的圈子名称
				}else{
					this.id = '';
					this.title = '选择圈子';
					this.quanzizhi = this.quanzizhi === 1 ? 0 : 1;
					this.quan_daohang_api(); // 圈子导航
					var e = this;
			        this.quan_list_api(e,false);
				}
				//console.log('圈子id',id+'圈子名称',title);

			},
			// 发布帖子接口
			fabu_api(){
				// 确保从 Vuex 获取最新值
				const uid = this.$store.state.memberuid;
                const keycode = this.$store.state.keycode;
				
				// 如果id为空
				if(!this.id){
					uni.showToast({
						icon: 'none',
						title: '请选择圈子'
					});
					return;
				}

				var title = this.title_20;
				// 优先获取h1-h5标签内的文字内容，否则获取第一个p标签内的文字内容
				var shortTitle = '';
				if (title) {
					// 优先检查h1-h5标题标签
					var hTags = ['h1', 'h2', 'h3', 'h4', 'h5'];
					var found = false;
					for (var i = 0; i < hTags.length; i++) {
						var hTag = hTags[i];
						var startTag = '<' + hTag;
						var endTag = '</' + hTag + '>';
						var hStart = title.indexOf(startTag);
						if (hStart !== -1) {
							var hEnd = title.indexOf('>', hStart);
							var hEndTag = title.indexOf(endTag, hEnd);
							if (hEnd !== -1 && hEndTag !== -1) {
								// 提取标题标签内的文字内容并过滤其中的HTML标签
								var hContent = title.substring(hEnd + 1, hEndTag).trim();
								shortTitle = hContent.replace(/<[^>]+>/g, '').trim();
								found = true;
								break;
							}
						}
					}
					
					// 如果没有找到h1-h5标签，则查找第一个p标签
					if (!found) {
						var firstPStart = title.indexOf('<p');
						if (firstPStart !== -1) {
							var firstPEnd = title.indexOf('>', firstPStart);
							var firstPEndTag = title.indexOf('</p>', firstPEnd);
							if (firstPEnd !== -1 && firstPEndTag !== -1) {
								// 提取p标签内的文字内容并过滤其中的HTML标签
								var pContent = title.substring(firstPEnd + 1, firstPEndTag).trim();
								shortTitle = pContent.replace(/<[^>]+>/g, '').trim();
							}
						}
					}
				}
				//var shortTitle = title ? title.substring(0, 20) : '';
				//console.log('shortTitle', shortTitle);
				
					// 上传图片
					let img = '';
					var jiugetu =this.fileList1;
					jiugetu.forEach(item=>{
						img+= '&data[jiugetu][id][]='+item.id+'&data[jiugetu][title][]=tupian'
					})
					// 上传视频
					// 上传图片
					/*let shippin = '';
					var up_shipin =this.fileList_shipin1;
					up_shipin.forEach(item=>{
						shippin+= '&data[shipin][id][]='+item.id+'&data[shipin][title][]=shipin'
					})*/
					// 上传附件
					let fujian = '';
					var up_fujian = this.fileList_fujian1;
					up_fujian.forEach(item=>{
						fujian+= '&data[wenjian][id][]='+item.id+'&data[wenjian][title][]='+item.title;
					})
					//把 this.neirong 全部化成html格式
					var neirong = this.neirong.replace(/\n/g, '<br>');
				var fjfs = this.fujian_feiyong_fjfs;
				var datas = "is_ajax=1&data[title]="+shortTitle+"&data[neirong]="+encodeURIComponent(neirong)+"&cid="+this.id+img+fujian+"&data[leixing]=2&data[fjkg]=1&data[fjfs]="+fjfs+"&data[tid]="+this.tid;
				// 如果this.leixing==1的时候 把 leixing 写到 datas 中
				if(this.leixing == 1){
					datas += '&data[leixing]='+this.leixing;
				}
				if(this.fujian_feiyong_jine > 0){
					datas += '&data[jine]='+this.fujian_feiyong_jine;
				}
				if(this.fujian_feiyong_jifen > 0){
					datas += '&data[jifen]='+this.fujian_feiyong_jifen;
				}
				var post_data = postRequest(QuanApi.postTiezi(uid,keycode,this.id),datas);
				var res;
				post_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code == -1){
						uni.showToast({
							icon: 'none',
							title: '没有开放发帖'
						});

					} else if(res.data.code) {
						uni.showToast({
							icon: 'none',
							title: res.data.msg
						});
						this.neirong = '';
						// 发布成功后跳转到当前圈子页面
						uni.navigateTo({
							url: '/pages/quanzi/index?id='+this.id,
							success: () => {
							console.log('跳转成功');
							},
							fail: (err) => {
							console.error('跳转失败:', err);
							uni.showToast({
									title: '跳转失败，请重试',
									icon: 'none'
							});
							}
						});
						
					} else {
						uni.showToast({
							icon: 'none',
							title: '发布失败'
						});
						
						
					}
				})
			},
		// 新增图片
		async afterRead(event) {
			var duixin = this; 
			// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				//console.log('event',event); 
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					// 判断文件类型
					const isImage = item.type.startsWith('image/');
					const isVideo = item.type.startsWith('video/');
					
					// 只处理图片和视频文件
					if (isImage || isVideo) {
						this[`fileList${event.name}`].push({
							...item,
							status: 'uploading',
							message: '上传中',
							fileType: isImage ? 'image' : 'video'
						})
					} else {
						uni.showToast({
							icon: 'none',
							title: '不支持的文件类型，请上传图片或视频'
						})
					}
				})
			for (let i = 0; i < lists.length; i++) {
				const result = await this.uploadFilePromise(lists[i].url,1)
				const id = duixin.uptu.data.id;
				//console.log('uptu',duixin.uptu.data.id); 
				let item = this[`fileList${event.name}`][fileListLen]
				// 更新文件列表状态
					const updatedItem = Object.assign(item, {
						status: 'success',
						message: '',
						url: result,
						id: id,
						fileType: item.fileType // 保留文件类型信息
					})
					this[`fileList${event.name}`].splice(fileListLen, 1, updatedItem)
					fileListLen++
					
					// 注释掉自动插入逻辑，根据用户需求取消自动插入
					// if (updatedItem.fileType === 'image') {
					// 	this.handleInsertImage({ url: result })
					// } else if (updatedItem.fileType === 'video') {
					// 	this.handleInsertVideo({ url: result })
					// }
				}
		},
		// 删除图片
		deletePic(event) {
			this[`fileList${event.name}`].splice(event.index, 1)
		},
		//上传图片
		uploadFilePromise(fileOrUrl, leixing, fileName) {
			
			
			var duixin = this; 
			//console.log('fabuidjiugetu',duixin.fabuid && duixin.fabuid.jiugetu); 
			const uid = this.$store.state.memberuid;
            const keycode = this.$store.state.keycode;
			if(leixing==1){
				// 图片上传
				var upid = duixin.fabuid && duixin.fabuid.jiugetu;
			} else if(leixing==2){
						// 附件上传
						var upid = duixin.fabuid && duixin.fabuid.fujianid;
					}

					
					return new Promise((resolve, reject) => {
						// 调试日志
						const uploadUrl = QuanApi.postTupians(uid,keycode)+'&fid='+upid;
						console.log('上传地址:', uploadUrl);
						console.log('uid:', uid);
						console.log('keycode:', keycode);
						console.log('upid:', upid);
						// 兼容 H5：支持直接上传 Blob/File，并带上文件名，避免后端无法识别扩展名
						const isH5 = typeof window !== 'undefined';
						const isBlobLike = isH5 && (fileOrUrl && (fileOrUrl instanceof Blob || (typeof File !== 'undefined' && fileOrUrl instanceof File)));
						const uploadOptions = {
							url: uploadUrl,
							name: 'file_data',
							formData: { is_ajax: 1 }
						};
						if (isBlobLike) {
							let fileObj = fileOrUrl;
							if (!(fileOrUrl instanceof File)) {
								const extFromType = (fileOrUrl.type && fileOrUrl.type.split('/')[1]) || 'bin';
								const safeFileName = fileName || ('upload.' + extFromType);
								try {
									fileObj = new File([fileOrUrl], safeFileName, { type: fileOrUrl.type || 'application/octet-stream' });
								} catch(e) {
									// 旧浏览器不支持 File 构造函数时，退化为直接上传 Blob
								}
							}
							uploadOptions.file = fileObj;
						} else {
							uploadOptions.filePath = fileOrUrl;
						}
						uploadOptions.success = (res) => {
								var duixin = this; 
								if(leixing==1){
									duixin.uptu = JSON.parse(res.data);
									const imgUrl = duixin.uptu.data.url || '';
									setTimeout(() => { resolve(imgUrl) }, 1000)
								} else if(leixing==2){
									duixin.up_fujian = JSON.parse(res.data);
									const fujianUrl = duixin.up_fujian.data.url || '';
									setTimeout(() => { resolve(fujianUrl) }, 1000)
								}
						};
						let a = uni.uploadFile(uploadOptions);
						});
					},
			// 新增：PDF第一页转 JPG（仅 H5 有效）
			// #ifdef H5
			async ensurePdfJs() {
				try {
					// 若已存在，直接设置 worker 即可
					if (typeof window !== 'undefined' && window.pdfjsLib) {
						if (window.pdfjsLib.GlobalWorkerOptions) {
							window.pdfjsLib.GlobalWorkerOptions.workerSrc = window.pdfjsLib.GlobalWorkerOptions.workerSrc || 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js';
						}
						return;
					}

					const candidates = [
						['https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js','https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js'],
						['https://cdn.jsdelivr.net/npm/pdfjs-dist@2.16.105/build/pdf.min.js','https://cdn.jsdelivr.net/npm/pdfjs-dist@2.16.105/build/pdf.worker.min.js'],
						['https://unpkg.com/pdfjs-dist@2.16.105/build/pdf.min.js','https://unpkg.com/pdfjs-dist@2.16.105/build/pdf.worker.min.js']
					];
					let loaded = false;
					for (let i = 0; i < candidates.length; i++) {
						const [libUrl, workerUrl] = candidates[i];
						try {
							console.log('[PDFJS] 尝试加载:', libUrl);
							await this.loadScript(libUrl);
							if (window.pdfjsLib) {
								if (window.pdfjsLib.GlobalWorkerOptions) {
									window.pdfjsLib.GlobalWorkerOptions.workerSrc = workerUrl;
								}
								loaded = true;
								break;
							}
						} catch (err) {
							console.warn('[PDFJS] 加载失败，继续尝试下一源:', err);
						}
					}
					if (!loaded || !window.pdfjsLib) {
						throw new Error('pdfjsLib 未加载');
					}
				} catch (e) {
					console.warn('[PDFJS] 加载失败:', e);
					throw e;
				}
			},
			loadScript(src) {
				return new Promise((resolve, reject) => {
					try {
						const s = document.createElement('script');
						s.src = src;
						s.async = true;
						s.onload = () => resolve();
						s.onerror = (err) => reject(err);
						document.head.appendChild(s);
					} catch (err) {
						reject(err);
					}
				});
			},
			async pdfFirstPageToJpeg(fileOrUrl) {
				// 确保 pdfjsLib 已加载
				if (typeof window === 'undefined' || !window.pdfjsLib) {
					await this.ensurePdfJs();
				}
				const pdfjsLib = window.pdfjsLib;
				if (!pdfjsLib) throw new Error('pdfjsLib 未加载');

				let arrayBuffer;
				try {
					// H5 多端兼容：优先使用原始 File/Blob
					if (fileOrUrl instanceof Blob) {
						arrayBuffer = await fileOrUrl.arrayBuffer();
					} else if (typeof fileOrUrl === 'string') {
						// 处理 data:URL（如 base64）
						if (fileOrUrl.startsWith('data:')) {
							const base64 = fileOrUrl.split(',')[1] || '';
							const binary = atob(base64);
							const len = binary.length;
							const bytes = new Uint8Array(len);
							for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i);
							arrayBuffer = bytes.buffer;
						} else {
							// 支持 blob: URL 或远程 URL
							const resp = await fetch(fileOrUrl);
							if (!resp.ok) throw new Error('获取PDF失败: ' + resp.status);
							arrayBuffer = await resp.arrayBuffer();
						}
					} else if (fileOrUrl && fileOrUrl.path) {
						// 兼容部分端的文件对象（如 {path: 'blob:...'}）
						const resp = await fetch(fileOrUrl.path);
						if (!resp.ok) throw new Error('获取PDF失败: ' + resp.status);
						arrayBuffer = await resp.arrayBuffer();
					} else {
						throw new Error('未知的PDF来源');
					}
				} catch (e) {
					console.warn('[PDF] 读取文件失败:', e);
					throw e;
				}

				const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;
				const page = await pdf.getPage(1);
				// 目标宽度 400px，按比例缩放（可根据需要调整 targetWidth）
				const baseViewport = page.getViewport({ scale: 1 });
				const targetWidth = 400;
				const scale = targetWidth / baseViewport.width;
				const viewport = page.getViewport({ scale });
				const canvas = document.createElement('canvas');
				const context = canvas.getContext('2d');
				// 设置画布为目标尺寸（保持比例）
				canvas.width = targetWidth;
				canvas.height = Math.round(baseViewport.height * scale);

				// 渲染到画布
				await page.render({ canvasContext: context, viewport }).promise;
				// 导出 JPEG，适当降低质量以进一步减小体积（可调）
				const jpgDataUrl = canvas.toDataURL('image/jpeg', 0.85);
				return jpgDataUrl;
			},
			// 在 PDF 转 JPG 方法后，新增 DOCX 预览依赖加载与首图生成方法（仅 H5 有效）
			async ensureDocxPreview() {
				try {
					// 总是确保 JSZip 为 3.x（docx-preview 需要 loadAsync）
					const jszipCandidates = [
						Config.getDomain + '/static/libs/jszip/jszip.min.js',
						'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js',
						'https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js',
						'https://unpkg.com/jszip@3.10.1/dist/jszip.min.js'
					];
					if (typeof window !== 'undefined') {
						const hasJSZip = !!window.JSZip;
						const ver = hasJSZip && window.JSZip.version ? window.JSZip.version : '';
						if (!hasJSZip || /^2\./.test(ver)) {
							for (let i = 0; i < jszipCandidates.length && (!window.JSZip || /^2\./.test(window.JSZip.version||'')); i++) {
								try {
									// 本地优先，若不存在则回退 CDN
									const url = jszipCandidates[i];
									if (url.startsWith('/static/')) {
										const headOk = await fetch(url, { method: 'HEAD' }).then(r => r.ok).catch(() => false);
										if (!headOk) { console.warn('[JSZip] 本地资源不存在，跳过:', url); continue; }
									}
									console.log('[JSZip] 尝试加载:', url);
									await this.loadScript(url);
								} catch (e) {
									console.warn('[JSZip] 加载失败，继续下一源:', e);
								}
							}
						}
					}
					// docx-preview 与 html2canvas 候选源
					const docxCandidates = [
						'https://cdnjs.cloudflare.com/ajax/libs/docx-preview/0.3.1/docx-preview.min.js',
						'https://cdn.jsdelivr.net/npm/docx-preview@0.3.1/dist/docx-preview.min.js',
						'https://unpkg.com/docx-preview@0.3.1/dist/docx-preview.min.js'
					];
					const html2CanvasCandidates = [
						'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js',
						'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js',
						'https://unpkg.com/html2canvas@1.4.1/dist/html2canvas.min.js'
					];
					let docxLoaded = !!(window.docx);
					let h2cLoaded = !!(window.html2canvas);
					// 如果 docx 已加载但 JSZip 为 2.x，先卸载 docx 并重新加载
					if (docxLoaded && window.JSZip && /^2\./.test(window.JSZip.version||'')) {
						console.warn('[DOCX预览] 检测到 JSZip 2.x，重新加载 docx-preview');
						try { delete window.docx; } catch(e) { window.docx = undefined; }
						docxLoaded = false;
					}
					for (let i = 0; i < docxCandidates.length && !docxLoaded; i++) {
						try {
							console.log('[DOCX预览] 尝试加载:', docxCandidates[i]);
							await this.loadScript(docxCandidates[i]);
							if (window.docx) docxLoaded = true;
						} catch(e) {
							console.warn('[DOCX预览] 加载失败，继续下一源:', e);
						}
					}
					for (let i = 0; i < html2CanvasCandidates.length && !h2cLoaded; i++) {
						try {
							console.log('[html2canvas] 尝试加载:', html2CanvasCandidates[i]);
							await this.loadScript(html2CanvasCandidates[i]);
							if (window.html2canvas) h2cLoaded = true;
						} catch(e) {
							console.warn('[html2canvas] 加载失败，继续下一源:', e);
						}
					}
					if (!docxLoaded || !h2cLoaded) {
						throw new Error('docx-preview 或 html2canvas 未加载');
					}
				} catch (e) {
					console.warn('[DOCX预览] 依赖加载失败:', e);
					throw e;
				}
			},
			async docxFirstPageToJpeg(fileOrUrl) {
				// 确保依赖已加载；若检测到 JSZip 为 2.x，也必须强制重新加载
				if (typeof window === 'undefined' || !window.docx || !window.html2canvas || (window.JSZip && /^2\./.test(window.JSZip.version||''))) {
					await this.ensureDocxPreview();
				}
				let arrayBuffer;
				try {
					if (fileOrUrl instanceof Blob) {
						arrayBuffer = await fileOrUrl.arrayBuffer();
					} else if (typeof fileOrUrl === 'string') {
						if (fileOrUrl.startsWith('data:')) {
							const base64 = fileOrUrl.split(',')[1] || '';
							const binary = atob(base64);
							const len = binary.length;
							const bytes = new Uint8Array(len);
							for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i);
							arrayBuffer = bytes.buffer;
						} else {
							const resp = await fetch(fileOrUrl);
							if (!resp.ok) throw new Error('获取DOCX失败: ' + resp.status);
							arrayBuffer = await resp.arrayBuffer();
						}
					} else if (fileOrUrl && fileOrUrl.path) {
						const resp = await fetch(fileOrUrl.path);
						if (!resp.ok) throw new Error('获取DOCX失败: ' + resp.status);
						arrayBuffer = await resp.arrayBuffer();
					} else {
						throw new Error('未知的DOCX来源');
					}
				} catch (e) {
					console.warn('[DOCX] 读取文件失败:', e);
					throw e;
				}
				// 创建离屏容器，限制尺寸近似 A4 首屏区域
				const container = document.createElement('div');
				container.style.cssText = 'position:fixed;left:-9999px;top:0;width:794px;height:1123px;overflow:hidden;background:#ffffff;';
				document.body.appendChild(container);
				try {
					// 渲染 DOCX 到容器（确保使用 JSZip 3.x，避免 loadAsync 不存在的问题）
					const __prevJSZip = (typeof window !== 'undefined') ? window.JSZip : null;
					try {
						if (typeof window !== 'undefined') {
							const hasJSZip = !!window.JSZip;
							const ver = hasJSZip && window.JSZip.version ? window.JSZip.version : '';
							if (!hasJSZip || /^2\./.test(ver)) {
								console.warn('[DOCX预览] 检测到 JSZip 缺失或版本为 2.x，尝试加载 3.x');
								await this.loadScript('https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js');
							}
						}
					} catch(e) {
						console.warn('[DOCX预览] 加载 JSZip 3.x 失败:', e);
					}
					// 尝试渲染，若因 JSZip 版本导致 loadAsync 不存在则强制修复后重试一次
					try {
						await window.docx.renderAsync(arrayBuffer, container, null);
					} catch (err) {
						const msg = String(err||'');
						if (/loadAsync is not a function/i.test(msg)) {
							console.warn('[DOCX预览] 捕获 loadAsync 错误，强制切换到 JSZip 3.x 并重载 docx-preview 后重试');
							try { delete window.JSZip; } catch(e) { window.JSZip = undefined; }
							await this.loadScript('https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js');
							try { delete window.docx; } catch(e) { window.docx = undefined; }
							// 复用 ensureDocxPreview 的加载逻辑
							await this.ensureDocxPreview();
							await window.docx.renderAsync(arrayBuffer, container, null);
						} else {
							throw err;
						}
					}
					// 尝试恢复原有 JSZip（若之前存在且被覆盖）
					try { if (__prevJSZip && window.JSZip && (window.JSZip !== __prevJSZip)) { window.JSZip = __prevJSZip; } } catch(e) {}

					// 强制将可能存在的包裹元素背景改为白色（避免灰色包装）
					try {
						const wrappers = container.querySelectorAll('.docx-wrapper, .docx-container, .docx, .page');
						wrappers.forEach(el => { el.style.background = '#ffffff'; });
					} catch(e) {}
					// 等待下一个帧，确保内容渲染完毕
					await new Promise(r => setTimeout(r, 80));
					// 若容器仍为空，额外再等待一次
					if (!container.firstChild || !(container.offsetWidth && container.offsetHeight)) {
						await new Promise(r => setTimeout(r, 120));
					}
					// 截图容器，生成画布
					const canvas = await window.html2canvas(container, { backgroundColor:'#ffffff', scale:1 });
					// 输出目标宽度 400px 的 JPEG
					const targetWidth = 400;
					const scale = targetWidth / canvas.width;
					const outCanvas = document.createElement('canvas');
					outCanvas.width = targetWidth;
					outCanvas.height = Math.round(canvas.height * scale);
					const ctx = outCanvas.getContext('2d');
					ctx.drawImage(canvas, 0, 0, outCanvas.width, outCanvas.height);
					const jpgDataUrl = outCanvas.toDataURL('image/jpeg', 0.85);
					return jpgDataUrl;
				} finally {
					try { document.body.removeChild(container); } catch(e) {}
				}
			},
			// 追加：PPTX 预览依赖加载与首图生成方法（仅 H5 有效）
			async ensurePptxPreview() {
				try {
					if (typeof window !== 'undefined' && (window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX) && window.JSZip) return;
					const jszipCandidates = [
							Config.getDomain + '/static/libs/jszip/jszip.min.js',
							// 优先使用 2.x 版本以兼容旧版 PPTXjs
							'https://cdnjs.cloudflare.com/ajax/libs/jszip/2.7.0/jszip.min.js',
							'https://cdn.jsdelivr.net/npm/jszip@2.7.0/dist/jszip.min.js',
							'https://unpkg.com/jszip@2.7.0/dist/jszip.min.js',
							// 作为备选，若 2.x 源不可用再尝试 3.x
							'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js',
							'https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js',
							'https://unpkg.com/jszip@3.10.1/dist/jszip.min.js'
						];
						if (!window.JSZip) {
							for (let i=0;i<jszipCandidates.length && !window.JSZip;i++) {
								const url = jszipCandidates[i];
								try {
									if (url.startsWith('/static/')) {
										const headOk = await fetch(url, { method: 'HEAD' }).then(r => r.ok).catch(() => false);
										if (!headOk) { console.warn('[JSZip] 本地资源不存在，跳过:', url); continue; }
									}
									console.log('[JSZip] 尝试加载:', url);
									await this.loadScript(url);
								} catch(e) { console.warn('[JSZip] 加载失败:', e); }
							}
							if (window.JSZip && window.JSZip.version && /^3\./.test(window.JSZip.version)) {
								console.warn('[JSZip] 已加载 3.x，某些旧版 PPTXjs 可能不兼容，建议使用 2.7.0');
							}
						}
						// 确保 jQuery（部分 PPTXjs 版本为 jQuery 插件形式）
						const jqCandidates = [
							'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
							'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js',
							Config.getDomain + '/static/libs/jquery/jquery.min.js'
						];
						if (!window.jQuery && !window.$) {
							for (let i=0;i<jqCandidates.length && !window.jQuery && !window.$;i++) {
								try { console.log('[jQuery] 尝试加载:', jqCandidates[i]); await this.loadScript(jqCandidates[i]); } catch(e) { console.warn('[jQuery] 加载失败，继续:', e); }
							}
						}
						const pptxCandidates = [
							// 本地优先（使用目录：/static/libs/pptxjs/ 下的构建文件）
							Config.getDomain + '/static/libs/pptxjs/pptxjs.min.js',
							Config.getDomain + '/static/libs/pptxjs/pptxjs.js',
							// 若本地是仓库原结构，可能位于 dist/
							Config.getDomain + '/static/libs/pptxjs/dist/pptxjs.min.js',
							Config.getDomain + '/static/libs/pptxjs/dist/pptxjs.js',
							// 官方仓库的 jsDelivr 镜像（通常包含 dist/*）
							'https://cdn.jsdelivr.net/gh/meshesha/PPTXjs/dist/pptxjs.min.js',
							'https://cdn.jsdelivr.net/gh/meshesha/PPTXjs/dist/pptxjs.js',
							// 备用：rawcdn.githack 镜像
							'https://rawcdn.githack.com/meshesha/PPTXjs/master/dist/pptxjs.min.js',
							'https://rawcdn.githack.com/meshesha/PPTXjs/master/dist/pptxjs.js',
							// 旧源（若可用）
							'https://cdn.jsdelivr.net/gh/gitbrent/PptxJS@2.1.4/dist/pptxjs.min.js',
							'https://cdn.jsdelivr.net/gh/gitbrent/PptxJS/dist/pptxjs.min.js'
						];
						let loaded = !!(window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX);
						// 先尝试本地资源，全部失败后再回退到 CDN，避免无意义的 404
						const localCandidates = pptxCandidates.filter(u => u.startsWith('/static/'));
						const cdnCandidates = pptxCandidates.filter(u => /^https?:\/\//.test(u));
						for (let i=0;i<localCandidates.length && !loaded;i++) {
							const url = localCandidates[i];
							try {
								const headOk = await fetch(url, { method: 'HEAD' }).then(r => r.ok).catch(() => false);
								if (!headOk) { console.warn('[PPTX预览] 本地资源不存在，跳过:', url); continue; }
								console.log('[PPTX预览] 尝试加载本地:', url);
								await this.loadScript(url);
								if (window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX) loaded = true;
							} catch(e) { console.warn('[PPTX预览] 本地加载失败，继续:', e); }
						}
						// 若本地不可用，尝试 CDN 备用源
						if (!loaded) {
							console.warn('[PPTX预览] 本地资源不可用，尝试 CDN 备用源');
							for (let i=0;i<cdnCandidates.length && !loaded;i++) {
								const url = cdnCandidates[i];
								try {
									console.log('[PPTX预览] 尝试加载 CDN:', url);
									await this.loadScript(url);
									if (window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX) loaded = true;
								} catch(e) { console.warn('[PPTX预览] CDN 加载失败，继续:', e); }
							}
						}
						if (!loaded) throw new Error('pptxjs 未加载');
					// 同时确保 html2canvas 可用（用于截图）
					const html2CanvasCandidates = [
						'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js',
						'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js',
						'https://unpkg.com/html2canvas@1.4.1/dist/html2canvas.min.js'
					];
					if (typeof window !== 'undefined' && !window.html2canvas) {
						let h2cLoaded = false;
						for (let i = 0; i < html2CanvasCandidates.length && !h2cLoaded; i++) {
							try { console.log('[html2canvas] 尝试加载:', html2CanvasCandidates[i]); await this.loadScript(html2CanvasCandidates[i]); if (window.html2canvas) h2cLoaded = true; } catch(e) { console.warn('[html2canvas] 加载失败，继续下一源:', e); }
						}
						if (!window.html2canvas) throw new Error('html2canvas 未加载');
					}
					// 额外确保 Fabric.js（部分 PPTX 渲染库依赖）
					const fabricCandidates = [
						'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.2.4/fabric.min.js',
						'https://cdn.jsdelivr.net/npm/fabric@5.2.4/dist/fabric.min.js',
						'https://unpkg.com/fabric@5.2.4/dist/fabric.min.js'
					];
					if (typeof window !== 'undefined' && !window.fabric) {
						let fabricLoaded = false;
						for (let i = 0; i < fabricCandidates.length && !fabricLoaded; i++) {
							try { console.log('[fabric] 尝试加载:', fabricCandidates[i]); await this.loadScript(fabricCandidates[i]); if (window.fabric) fabricLoaded = true; } catch(e) { console.warn('[fabric] 加载失败，继续下一源:', e); }
						}
					}
					// 注入 PPTXJS 样式（如有），避免渲染缺少样式
							if (!document.querySelector('link[href*="pptxjs"]')) {
							const cssCandidates = [
									Config.getDomain + '/static/libs/pptxjs.css',
									Config.getDomain + '/static/libs/pptxjs/pptxjs.min.css',
									Config.getDomain + '/static/libs/pptxjs/pptxjs.css',
									// 若本地是仓库原结构，可能位于 dist/
									Config.getDomain + '/static/libs/pptxjs/dist/pptxjs.min.css',
									Config.getDomain + '/static/libs/pptxjs/dist/pptxjs.css',
									// 官方仓库的 jsDelivr 镜像
									'https://cdn.jsdelivr.net/gh/meshesha/PPTXjs/dist/pptxjs.min.css',
									'https://cdn.jsdelivr.net/gh/meshesha/PPTXjs/dist/pptxjs.css',
									// 备用：rawcdn.githack 镜像
									'https://rawcdn.githack.com/meshesha/PPTXjs/master/dist/pptxjs.min.css',
									'https://rawcdn.githack.com/meshesha/PPTXjs/master/dist/pptxjs.css',
									// 旧源（若可用）
									'https://cdn.jsdelivr.net/gh/gitbrent/PptxJS@2.1.4/dist/pptxjs.min.css',
									'https://cdn.jsdelivr.net/gh/gitbrent/PptxJS/dist/pptxjs.min.css'
								];
							// 先尝试本地 CSS，失败再回退到 CDN
							let cssInjected = false;
							const localCss = cssCandidates.filter(u => u.startsWith('/static/'));
							const cdnCss = cssCandidates.filter(u => /^https?:\/\//.test(u));
							for (let i=0;i<localCss.length && !cssInjected;i++) {
									const url = localCss[i];
									try {
										const headOk = await fetch(url, { method: 'HEAD' }).then(r => r.ok).catch(() => false);
										if (!headOk) { console.warn('[PPTX CSS] 本地资源不存在，跳过:', url); continue; }
										const link = document.createElement('link');
										link.rel = 'stylesheet';
										link.href = url;
										document.head.appendChild(link);
										cssInjected = true;
										console.log('[PPTX预览] CSS 注入(本地):', url);
										break;
									} catch(e) { console.warn('[PPTX CSS] 注入失败，继续下一源:', e); }
								}
							if (!cssInjected) {
									console.warn('[PPTX预览] 本地 CSS 不可用，尝试 CDN 备用源');
									for (let i=0;i<cdnCss.length && !cssInjected;i++) {
										const url = cdnCss[i];
										try {
											const link = document.createElement('link');
											link.rel = 'stylesheet';
											link.href = url;
											document.head.appendChild(link);
											cssInjected = true;
											console.log('[PPTX预览] CSS 注入(CDN):', url);
											break;
										} catch(e) { console.warn('[PPTX CSS] 注入失败，继续下一源:', e); }
									}
							}
						}
					} catch(e) {
						console.warn('[PPTX预览] 依赖加载失败:', e);
					throw e;
				}
			},
			async pptxFirstSlideToJpeg(fileOrUrl) {
					if (typeof window === 'undefined' || !(window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX) || !window.JSZip) {
						await this.ensurePptxPreview();
					}
				let arrayBuffer;
				try {
					if (fileOrUrl instanceof Blob) {
						arrayBuffer = await fileOrUrl.arrayBuffer();
					} else if (typeof fileOrUrl === 'string') {
						if (fileOrUrl.startsWith('data:')) {
							const base64 = fileOrUrl.split(',')[1] || '';
							const binary = atob(base64);
							const len = binary.length;
							const bytes = new Uint8Array(len);
							for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i);
							arrayBuffer = bytes.buffer;
						} else {
							const resp = await fetch(fileOrUrl);
							if (!resp.ok) throw new Error('获取PPTX失败: ' + resp.status);
							arrayBuffer = await resp.arrayBuffer();
						}
					} else if (fileOrUrl && fileOrUrl.path) {
						const resp = await fetch(fileOrUrl.path);
						if (!resp.ok) throw new Error('获取PPTX失败: ' + resp.status);
						arrayBuffer = await resp.arrayBuffer();
					} else {
						throw new Error('未知的PPTX来源');
					}
				} catch (e) {
					console.warn('[PPTX] 读取文件失败:', e);
					throw e;
				}
				// 使用 pptxjs 渲染第一张幻灯片到隐藏容器并截图
				const container = document.createElement('div');
				container.style.cssText = 'position:fixed;left:-9999px;top:0;width:1024px;height:768px;overflow:hidden;background:#ffffff;';
				document.body.appendChild(container);
				try {
						// 创建 viewer 并加载（兼容多命名），优先使用 ArrayBuffer，失败则回退 Blob URL
						const PPTXCtor = window.PPTXjs || window.PptxJS || window.pptxjs || window.PPTX;
						if (!PPTXCtor) throw new Error('未找到 PPTX 渲染构造（PPTXjs/PptxJS/PPTX）');
						const viewer = new PPTXCtor();
						let loadedOk = false;
						try {
							await viewer.load(arrayBuffer, container);
							loadedOk = true;
						} catch(e) {
							console.warn('[PPTX] 使用 ArrayBuffer 加载失败，尝试 Blob URL:', e);
						}
						if (!loadedOk) {
							const blobUrl = URL.createObjectURL(new Blob([arrayBuffer], { type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' }));
							try {
								await viewer.load(blobUrl, container);
								loadedOk = true;
							} catch(e2) {
								console.error('[PPTX] Blob URL 加载也失败:', e2);
								throw e2;
							}
						}
						// 等待渲染完成：优先轮询容器内画布/幻灯片节点出现，其次时间等待
						let ready = false; let tries = 0;
						while (!ready && tries < 20) { // 最多 ~2s
							await new Promise(r => setTimeout(r, 100));
							tries++;
							const slideEl = container.querySelector('canvas, svg, .slide, .pptxjs-slide');
							if (slideEl) ready = true;
						}
						if (!ready) {
							// 兜底再等 500ms
							await new Promise(r => setTimeout(r, 500));
						}
						// 优先尝试直接读取第一张幻灯片的 canvas
					let jpgDataUrl = '';
					try {
						const slideCanvas = container.querySelector('canvas');
						if (slideCanvas && slideCanvas.width && slideCanvas.height) {
							const targetWidth = 400;
							const ratio = targetWidth / slideCanvas.width;
							const targetHeight = Math.round(slideCanvas.height * ratio);
							const outCanvas = document.createElement('canvas');
							outCanvas.width = targetWidth; outCanvas.height = targetHeight;
							const ctx = outCanvas.getContext('2d');
							ctx.fillStyle = '#ffffff'; ctx.fillRect(0,0,targetWidth,targetHeight);
							ctx.drawImage(slideCanvas, 0, 0, targetWidth, targetHeight);
							jpgDataUrl = outCanvas.toDataURL('image/jpeg', 0.85);
						}
					} catch(e) {
						console.warn('[PPTX] 直接读取画布首图失败，改用 html2canvas:', e);
					}
					if (!jpgDataUrl) {
						// 兜底使用 html2canvas 截容器
						const canvas = await window.html2canvas(container, { backgroundColor:'#ffffff', scale:1, useCORS:true, allowTaint:true, foreignObjectRendering:true });
						const targetWidth = 400;
						const scale = targetWidth / canvas.width;
						const outCanvas = document.createElement('canvas');
						outCanvas.width = targetWidth;
						outCanvas.height = Math.round(canvas.height * scale);
						const ctx = outCanvas.getContext('2d');
						ctx.fillStyle = '#ffffff'; ctx.fillRect(0,0,outCanvas.width,outCanvas.height);
						ctx.drawImage(canvas, 0, 0, outCanvas.width, outCanvas.height);
						jpgDataUrl = outCanvas.toDataURL('image/jpeg', 0.85);
					}
					return jpgDataUrl;
				} finally {
					try { document.body.removeChild(container); } catch(e) {}
				}
			},
			// #endif
			//发布id
		getFabuid_api(){
			var duixin = this; 
			var get_data = getRequest(Api.getFabuid());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						duixin.fabuid = res.data.data;
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
		},
		// 图片预览方法
		clickPreview(event) {
			//console.log('clickPreview事件触发', event);
			// 获取当前点击的图片索引
			const index = event.index;
			// 获取所有图片的url数组
			const urls = this.fileList1.map(item => item.url);
			//console.log('图片URL列表', urls);
			//console.log('当前索引', index);
			// 调用uni-app的图片预览API
			uni.previewImage({
				urls: urls,
				current: index,
				success: function(res) {
					//console.log('预览成功', res);
				},
				fail: function(err) {
					console.error('预览失败', err);
				}
			});
		},
		// 附件上传
		async afterRead_fujian(event) {
			var duixin = this; 
			// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				//console.log('event',event); 
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList_fujian${event.name}`].length

				lists.map((item) => {
					// 判断文件类型：图片、视频、或文档/压缩包（rar/zip/pdf/docx/doc）
					const isImage = item.type && item.type.startsWith('image/');
					const isVideo = item.type && item.type.startsWith('video/');
					const allowedExts = ['rar', 'zip', 'pdf', 'docx', 'doc', 'pptx', 'ppt', 'txt']; // 支持格式扩展：新增PPT/PPTX
					const ext = ((item.name || item.url || '') + '').split('.').pop().toLowerCase();
					const allowedMimes = [
						'application/pdf',
						'application/zip',
						'application/x-zip-compressed',
						'application/x-rar-compressed',
						'application/msword',
						'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
						'application/vnd.ms-powerpoint',
						'application/vnd.openxmlformats-officedocument.presentationml.presentation'
					];
					const isDoc = (item.type && allowedMimes.includes(item.type)) || allowedExts.includes(ext);
					
					// 处理图片、视频、以及文档/压缩包文件
					if (isImage || isVideo || isDoc) {
						// 提取原始文件名作为附件标题，后续用于显示与发布（兼容 item.file.name）
						const baseName = (((item.name || (item.file && item.file.name) || item.url || '') + '').split('/').pop()) || '';
						// 调试输出，帮助定位文件名获取问题
						console.log('[附件选择] 原始项:', item);
						console.log('[附件选择] 提取文件名 baseName:', baseName, 'type:', item.type, 'name:', item.name, 'url:', item.url, 'file.name:', item.file && item.file.name);
						// 如果是 PDF/ZIP/RAR/DOC/DOCX，在选择时立即将文件名追加到正文内容中
						let baseExt = (baseName.split('.').pop() || '').toLowerCase();
					// 兜底：尝试根据 MIME 类型识别
					if (!baseExt) {
						const mime = (item.type || '').toLowerCase();
						if (mime.includes('application/pdf')) baseExt = 'pdf';
						else if (mime.includes('msword')) baseExt = 'doc';
						else if (mime.includes('wordprocessingml')) baseExt = 'docx';
						else if (mime.includes('presentationml')) baseExt = 'pptx';
						else if (mime.includes('ms-powerpoint')) baseExt = 'ppt';
						else if (mime.includes('zip')) baseExt = 'zip';
						else if (mime.includes('rar')) baseExt = 'rar';
					}
					// 兜底：再次从 name/url 中解析扩展名
					if (!baseExt) {
						const extFromName = (((item.name || (item.file && item.file.name) || item.url || '') + '').split('.').pop() || '').toLowerCase();
						baseExt = extFromName;
					}
					console.log('[附件选择] 提取扩展名 baseExt:', baseExt, 'mime:', item.type);
						const nameExtsToAppend = ['pdf','zip','rar','doc','docx','pptx','ppt'];
						if (nameExtsToAppend.includes(baseExt)) {
								// 仅向编辑器 HTML 追加标题，避免正文重复产生 <p> 包裹
								console.log('[追加标题到编辑器HTML] baseName:', baseName);
								// 同步到编辑器的HTML（valueHtml绑定），让页面也能看到追加的文件名
								try {
									const additionHtml = `<h3>${baseName}</h3>`;
									// 去除开头可能存在的空段落 <p><br></p> / <p>&nbsp;</p> / <p>\s*</p>
									const cleanedHtml = (this.valueHtml || '').replace(/^(?:<p><br><\/p>|<p>&nbsp;<\/p>|<p>\s*<\/p>)+/, '');
									// 将标题放到最前面，避免任何 <p> 在其之前
									this.valueHtml = additionHtml + cleanedHtml;
									console.log('[同步到编辑器] valueHtml 新值长度:', (this.valueHtml || '').length);
									
								} catch(syncErr) {
								console.warn('[同步编辑器失败]', syncErr);
							}
						}
						this[`fileList_fujian${event.name}`].push({
							...item,
							status: 'uploading',
							message: '上传中',
							fileType: isImage ? 'image' : (isVideo ? 'video' : 'file'),
							title: baseName
						})
						// 如果是 PDF，尝试在 H5 端生成第一页的 JPG 预览
						// #ifdef H5
						;(async () => {
							try {
								if (((baseExt === 'pdf') || (item.type === 'application/pdf')) && (item.file || item.url)) {
											console.log('[PDF首图] 准备生成，来源类型:', item.file ? ('Blob(' + (item.file.size || '?') + ')') : (typeof item.url + ':' + (item.url || '').slice(0,32)));
											await this.ensurePdfJs();
											const jpgDataUrl = await this.pdfFirstPageToJpeg(item.file || item.url);
											const idx = this[`fileList_fujian${event.name}`].length - 1;
											if (idx >= 0) {
												this[`fileList_fujian${event.name}`][idx].pdfFirstPageJpg = jpgDataUrl;
											console.log('[PDF首图] 生成成功，JPG长度:', (jpgDataUrl || '').length);
											// 调试输出完整 DataURL（截断到前200字符）
											console.log('[PDF首图] DataURL 前缀:', (jpgDataUrl || '').split(',')[0]);
											console.log('[PDF首图] DataURL 预览(前200字符):', (jpgDataUrl || '').slice(0, 200) + '...');
											// 额外：提取纯 Base64 数据并保存，满足“转换为base64编码的图片数据”的需求
																const base64Data = (jpgDataUrl || '').split(',')[1] || '';
																this[`fileList_fujian${event.name}`][idx].pdfFirstPageBase64 = base64Data;
																console.log('[PDF首图] Base64 长度:', base64Data.length);
																console.log('[PDF首图] Base64 预览(前200字符):', base64Data.slice(0, 200) + '...');
																// 新增：将 PSD/PDF 首图上传到图片接口 fileList1
																try {
																	const byteChars = atob(base64Data);
																	const bytes = new Uint8Array(byteChars.length);
																	for (let i = 0; i < byteChars.length; i++) {
																		bytes[i] = byteChars.charCodeAt(i);
																	}
																	const blob = new Blob([bytes], { type: 'image/jpeg' });
									// 在 H5 端使用 File，确保文件名带有扩展名，避免后端无法读取文件扩展名
									let fileToUpload;
									try {
										fileToUpload = new File([blob], 'pdf-firstpage.jpg', { type: 'image/jpeg' });
									} catch(e) {
										// 兼容旧浏览器，退化为直接上传 Blob
										fileToUpload = blob;
									}
									const fileListLenImg = this.fileList1.length;
									this.fileList1.push({
										url: jpgDataUrl,
										status: 'uploading',
										message: '上传中',
										fileType: 'image',
										name: 'pdf-firstpage.jpg',
										type: 'image/jpeg'
									});
									const uploadedUrl = await this.uploadFilePromise(fileToUpload, 1, 'pdf-firstpage.jpg');
									const uploadedId = (this.uptu && this.uptu.data && this.uptu.data.id) || '';
									const updatedItem = Object.assign({}, this.fileList1[fileListLenImg], {
										status: 'success',
										message: '',
										url: uploadedUrl,
										id: uploadedId,
										fileType: 'image',
										name: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].name) || 'pdf-firstpage.jpg',
										type: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].type) || 'image/jpeg'
									});
									this.fileList1.splice(fileListLenImg, 1, updatedItem);
									console.log('[PDF首图] 已上传到图片接口 fileList1，url:', uploadedUrl, 'id:', uploadedId);
								} catch (uploadErr) {
																	console.warn('[PDF首图] 上传到图片接口失败:', uploadErr);
																	try { uni.showToast({ title: '首图上传失败', icon: 'none' }); } catch(e) {}
																}
																}
																// 将图片插入到正文末尾（this.neirong）
																try {
																	const imgHtml = `<p><img src="${jpgDataUrl}" style="max-width:100%;height:auto;" /></p>`;
												const prefix = this.neirong ? '\n' : '';
												this.neirong = (this.neirong || '') + prefix + imgHtml;
												console.log('[PDF首图] 已追加到 neirong，长度:', (this.neirong || '').length);
												// 同步到编辑器内容，让界面也能立即看到图片
												// 优先使用编辑器API插入，确保界面立即显示
																																	if (this.handleInsertImage) {
																																		this.handleInsertImage({ url: jpgDataUrl, thumb: jpgDataUrl });
																																	} else if (this.editorRef && this.editorRef.getHtml && this.editorRef.setHtml) {
																																		// 兜底：直接在编辑器内容末尾追加
																																		const currentHtml = this.editorRef.getHtml() || '';
																																		this.editorRef.setHtml(currentHtml + imgHtml);
																																	} else {
																																		// 再兜底：更新绑定的valueHtml
																																		this.valueHtml = (this.valueHtml || '') + imgHtml;
																																	}
											} catch (appendErr) {
												console.warn('[PDF首图] 追加到正文失败:', appendErr);
											}
										}
								} catch (pdfErr) {
									console.warn('[PDF首图] 生成失败:', pdfErr);
								}
							})();

						;(async () => {
							try {
								if (((baseExt === 'docx') || (item.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document')) && (item.file || item.url)) {
									console.log('[DOCX首图] 准备生成，来源类型:', item.file ? ('Blob(' + (item.file.size || '?') + ')') : (typeof item.url + ':' + (item.url || '').slice(0,32)));
									await this.ensureDocxPreview();
									const jpgDataUrl = await this.docxFirstPageToJpeg(item.file || item.url);
									const idx = this[`fileList_fujian${event.name}`].length - 1;
									if (idx >= 0) {
										this[`fileList_fujian${event.name}`][idx].docxFirstPageJpg = jpgDataUrl;
										const base64Data = (jpgDataUrl || '').split(',')[1] || '';
										this[`fileList_fujian${event.name}`][idx].docxFirstPageBase64 = base64Data;
										try {
											const byteChars = atob(base64Data);
											const bytes = new Uint8Array(byteChars.length);
											for (let i = 0; i < byteChars.length; i++) { bytes[i] = byteChars.charCodeAt(i); }
											const blob = new Blob([bytes], { type: 'image/jpeg' });
											let fileToUpload;
											try { fileToUpload = new File([blob], 'docx-firstpage.jpg', { type: 'image/jpeg' }); } catch(e) { fileToUpload = blob; }
											const fileListLenImg = this.fileList1.length;
											this.fileList1.push({ url: jpgDataUrl, status: 'uploading', message: '上传中', fileType: 'image', name: 'docx-firstpage.jpg', type: 'image/jpeg' });
											const uploadedUrl = await this.uploadFilePromise(fileToUpload, 1, 'docx-firstpage.jpg');
											const uploadedId = (this.uptu && this.uptu.data && this.uptu.data.id) || '';
											const updatedItem = Object.assign({}, this.fileList1[fileListLenImg], { status: 'success', message: '', url: uploadedUrl, id: uploadedId, fileType: 'image', name: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].name) || 'docx-firstpage.jpg', type: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].type) || 'image/jpeg' });
											this.fileList1.splice(fileListLenImg, 1, updatedItem);
										} catch (uploadErr) {
											try { uni.showToast({ title: '首图上传失败', icon: 'none' }); } catch(e) {}
										}
									}
									try {
										const imgHtml = `<p><img src="${jpgDataUrl}" style="max-width:100%;height:auto;" /></p>`;
										const prefix = this.neirong ? '\n' : '';
										this.neirong = (this.neirong || '') + prefix + imgHtml;
										if (this.handleInsertImage) { this.handleInsertImage({ url: jpgDataUrl, thumb: jpgDataUrl }); }
										else if (this.editorRef && this.editorRef.getHtml && this.editorRef.setHtml) { const currentHtml = this.editorRef.getHtml() || ''; this.editorRef.setHtml(currentHtml + imgHtml); }
										else { this.valueHtml = (this.valueHtml || '') + imgHtml; }
									} catch (appendErr) {
										console.warn('[DOCX首图] 追加到正文失败:', appendErr);
									}
								} else if ((baseExt === 'doc') || (item.type === 'application/msword')) {
									try { uni.showToast({ title: '暂不支持DOC文件前端生成首图，请转为DOCX或PDF', icon: 'none' }); } catch(e) {}
								}
							} catch (err) {
								console.warn('[DOCX首图] 生成失败:', err);
							}
						})();

					;(async () => {
						try {
							if (((baseExt === 'pptx') || (item.type === 'application/vnd.openxmlformats-officedocument.presentationml.presentation')) && (item.file || item.url)) {
								console.log('[PPTX首图] 准备生成，来源类型:', item.file ? ('Blob(' + (item.file.size || '?') + ')') : (typeof item.url + ':' + (item.url || '').slice(0,32)));
								await this.ensurePptxPreview();
								const jpgDataUrl = await this.pptxFirstSlideToJpeg(item.file || item.url);
								const idx = this[`fileList_fujian${event.name}`].length - 1;
								if (idx >= 0) {
									this[`fileList_fujian${event.name}`][idx].pptxFirstPageJpg = jpgDataUrl;
									const base64Data = (jpgDataUrl || '').split(',')[1] || '';
									this[`fileList_fujian${event.name}`][idx].pptxFirstPageBase64 = base64Data;
									try {
										const byteChars = atob(base64Data);
										const bytes = new Uint8Array(byteChars.length);
										for (let i = 0; i < byteChars.length; i++) { bytes[i] = byteChars.charCodeAt(i); }
										const blob = new Blob([bytes], { type: 'image/jpeg' });
										let fileToUpload;
										try { fileToUpload = new File([blob], 'pptx-firstpage.jpg', { type: 'image/jpeg' }); } catch(e) { fileToUpload = blob; }
										const fileListLenImg = this.fileList1.length;
										this.fileList1.push({ url: jpgDataUrl, status: 'uploading', message: '上传中', fileType: 'image', name: 'pptx-firstpage.jpg', type: 'image/jpeg' });
										const uploadedUrl = await this.uploadFilePromise(fileToUpload, 1, 'pptx-firstpage.jpg');
										const uploadedId = (this.uptu && this.uptu.data && this.uptu.data.id) || '';
										const updatedItem = Object.assign({}, this.fileList1[fileListLenImg], { status: 'success', message: '', url: uploadedUrl, id: uploadedId, fileType: 'image', name: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].name) || 'pptx-firstpage.jpg', type: (this.fileList1[fileListLenImg] && this.fileList1[fileListLenImg].type) || 'image/jpeg' });
										this.fileList1.splice(fileListLenImg, 1, updatedItem);
									} catch (uploadErr) {
										try { uni.showToast({ title: '首图上传失败', icon: 'none' }); } catch(e) {}
									}
								}
								try {
									const imgHtml = `<p><img src="${jpgDataUrl}" style="max-width:100%;height:auto;" /></p>`;
									const prefix = this.neirong ? '\n' : '';
									this.neirong = (this.neirong || '') + prefix + imgHtml;
									if (this.handleInsertImage) { this.handleInsertImage({ url: jpgDataUrl, thumb: jpgDataUrl }); }
									else if (this.editorRef && this.editorRef.getHtml && this.editorRef.setHtml) { const currentHtml = this.editorRef.getHtml() || ''; this.editorRef.setHtml(currentHtml + imgHtml); }
									else { this.valueHtml = (this.valueHtml || '') + imgHtml; }
								} catch (appendErr) {
									console.warn('[PPTX首图] 追加到正文失败:', appendErr);
								}
							} else if ((baseExt === 'ppt') || (item.type === 'application/vnd.ms-powerpoint')) {
								try { uni.showToast({ title: '暂不支持PPT文件前端生成首图，请转为PPTX或PDF', icon: 'none' }); } catch(e) {}
							}
						} catch (err) {
							console.warn('[PPTX首图] 生成失败:', err);
						}
					})();
					// #endif
					} else {
						uni.showToast({
							icon: 'none',
							title: '不支持的文件类型，请上传图片、视频或文档（rar/zip/pdf/docx/doc/pptx/ppt）'
						})
					}
				})
			for (let i = 0; i < lists.length; i++) {
				const result = await this.uploadFilePromise(lists[i].url,2)
				const id = duixin.up_fujian.data.id;
				//console.log('up_fujian',duixin.up_fujian.data.id); 
				let item = this[`fileList_fujian${event.name}`][fileListLen]
				// 更新文件列表状态
					const updatedItem = Object.assign(item, {
						status: 'success',
						message: '',
						url: result,
						id: id,
						fileType: item.fileType // 保留文件类型信息
					})
					this[`fileList_fujian${event.name}`].splice(fileListLen, 1, updatedItem)
					console.log('[附件上传成功] 队列更新项:', updatedItem)

					fileListLen++
					
					// 注释掉自动插入逻辑，根据用户需求取消自动插入
					// if (updatedItem.fileType === 'image') {
					// 	this.handleInsertImage({ url: result })
					// } else if (updatedItem.fileType === 'video') {
					// 	this.handleInsertVideo({ url: result })
					// }
				}
		},
		// 删除视频
		delete_fujian(event) {
			this[`fileList_fujian${event.name}`].splice(event.index, 1)
		},
		// 退出登录
		handleLogout() {
			
			this.godenglu(); // 暂时注释掉自动跳转，便于调试
			
		},
		//返回
		fanhui(){
			uni.navigateBack({
				delta: 1
			})
		},
		//跳转个人信息
		godenglu(){
			//保持url到缓存，名称是u_url
			uni.setStorageSync('go_url', this.$route.fullPath);
			uni.navigateTo({
				url: '/pages/u/denglu',
			})
		},

	}
}
</script>



<style scoped>
    .d-xuanze-0 {
		position: relative; /* 建立定位上下文 */
	}

	.d-xuanze-1 {
		position: absolute; /* 相对于父元素定位 */
		top: 0; /* 顶部对齐 */
		left: 0; /* 左侧对齐 */
		width: 100%; /* 宽度填满父元素 */
		background-color: #ffffff;
	}

	.d-dibu-50 {
		position: fixed;
		
		bottom: 0px;
		left: 0;
		right: 0;
		z-index: 999;
		/*background-color: #fff;*/ /* 可以根据需要调整背景色 */
		padding: 10px 0; /* 可以根据需要调整内边距 */
	}
	.d-dibu-juzhong {
		/* 最大宽 1500px */
		padding-left: 10px;
		padding-right: 10px;
		max-width: 1390px;
		margin: 0 auto; /* 左右居中 */

		
		/*background-color: #8f8f94;*/

	}
	.scroll-fix {
		overflow-y: hidden;
	}

	.content {
		display: flex;
		flex-direction: column;
		/*align-items: center;*/
		
		background-color: #f3f3f3;
		/*padding-top: 70px;
		margin-bottom: 70px;*/
		/*height: 100vh;*//* 添加全屏 */
		width: 100vw; /* 添加全屏*/
		box-sizing: border-box;
		

	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	/* 屏幕宽度大于786px时隐藏uni-page-head */
    @media (min-width: 786px) {
        uni-page-head {
            display: none !important;
            opacity: 0 !important;
            height: 0 !important;
            visibility: hidden !important;
        }
    }
	/*.d-daohang{
		
		width: 600rpx;
	}*/
	/* 添加在style部分 */
	.d-daohang-zuo {
    position: fixed;
    left: 0;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #f5f5f5;
    z-index: 100;
	box-shadow: 2px 0 5px rgba(177, 177, 177, 0.1);
  }
  
  .d-daohang-you {
    position: fixed;
    left: 180rpx;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #fff;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  }
   
   
   
   
   
   
   
   
   
 
   
  .d-erji-item {
    height: 60rpx;
    line-height: 60rpx;
    padding: 0 20rpx;
   /* border-bottom: 1px solid #f0f0f0;*/
  }
  
  .d-erji-item:active {
    background: #f5f5f5;
  }
  .you-guding {
	position: fixed;
	top: 0; /* 根据头部高度调整 */
	/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
	transition: all 0.3s ease;
}
/* 大于786px时的样式 */
@media screen and (min-width: 1024px) {
	.d-bianhua-10 {
		padding: 30px;
	}
	.pc-zuo-520 {
		margin-left: 520rpx;
	}
	.you-guding {
		position: fixed;
			
		top: 60px; /* 根据头部高度调整 */
		/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
		transition: all 0.3s ease;
	}
		
	
}
	
</style>
